package healththink

class Forum {
    User user
    UserType userType
    String topic
    Date datePosted = new Date()
    Facility facility
    
    //static belongsTo = Facility
    
    static hasMany = [posts: Post]

    static constraints = {
        topic(blank: false, size: 1..100)
        userType(nullable: true)
	datePosted(blank: false)
        user(nullable: true)
    }
    
    static fetchMode = [
        posts:"eager"
    ]
    
    static mapping = {
        sort datePosted: "desc"
        user lazy:false
        facility lazy:false
    }
}
